package com.xtpt.disaster.common.consts;

import java.util.HashMap;
import java.util.Map;

public enum ScheduleTypeEnum implements BaseEnum{
    IMMEDIATELY("立刻执行任务", 0),
    START_AT("在指定时间执行一次", 1),
    CALENDAR_INTERVAL("日、周、月、年周期性执行", 2),
    CORN("根据Corn表达式执行", 3);
    /**
     * 描述
     */
    private String description;
    /**
     * 值
     */
    private int value;
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    // 构造方法
    private ScheduleTypeEnum(String description, int value) {
        this.description = description;
        this.value = value;
    }

    public static ScheduleTypeEnum getObject(Integer value){
        for(ScheduleTypeEnum scheduleTypeEnum: ScheduleTypeEnum.values()) {
            if(scheduleTypeEnum.getValue().equals(value)){
                return scheduleTypeEnum;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return this.value+"_"+this.description;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }
}
